package com.yazi.mxz.behavior.service.impl;

import javax.annotation.Resource;

import com.myframework.smhj.hibernate.Searching;
import com.myframework.smhj.hibernate.Page;
import com.yazi.mxz.behavior.dao.StoreGoodsDao;
import com.yazi.mxz.behavior.entity.beans.StoreGoods;
import com.yazi.mxz.behavior.service.StoreGoodsService;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;


@Service("storeGoodsService")
public class StoreGoodsServiceImpl implements StoreGoodsService {
	private static Logger log = LoggerFactory.getLogger(StoreGoodsServiceImpl.class);

	@Resource
	StoreGoodsDao storeGoodsDao;
	

	@Override
	public StoreGoods oneById(long storeGoodsId) {
		log.debug("oneById：storeGoodsId={}", storeGoodsId);
		return storeGoodsDao.get(storeGoodsId);
	}

	@Override
	public Page<StoreGoods> list(StoreGoods storeGoods, Searching si) {
		log.debug("list：");
		return storeGoodsDao.listByExample(storeGoods, si);
	}

	@Override
	public int count(StoreGoods storeGoods, String searchWord) {
		log.debug("count：");
		return storeGoodsDao.countByExample(storeGoods, searchWord);
	}

	@Override
	public Page<StoreGoods> listInStock(StoreGoods storeGoods, Searching si) {
		log.debug("listInStock: storeId={}", storeGoods.getStoreId());
		return null;//storeGoodsDao.inStock(storeGoods, si, si.getSearchWord);
	}

	@Override
	public Page<StoreGoods> listFromSameOrder(long storeGoodsId, Searching si) {
		return null;
	}
	
	@Override
	public Page<StoreGoods> listByGtUpdateTime(long updateTime, Searching si) {
		log.debug("listByGtUpdateTime：updateTime={},nowPage={}", updateTime, si.getNowPage());
		return storeGoodsDao.listByGtUpdateTime(updateTime, si);
	}
	
}
